package com.example.sbbsec.quartz.entity.schedule.simple;

import com.example.sbbsec.quartz.entity.schedule.ScheduleJob;
import com.example.sbbsec.quartz.executor.AbstractJobExecutor;
import com.google.common.base.MoreObjects;

import java.util.concurrent.TimeUnit;

/**
 * 简单 任务
 *
 * @author lowe.yang
 * @date 2019-01-04 10:37
 */
public class SimpleJob extends ScheduleJob {
    public SimpleJob() {
        super();
    }

    public SimpleJob(String jobName) {
        super(jobName);
    }

    public SimpleJob(String jobName, Class<? extends AbstractJobExecutor> executor) {
        super(jobName, executor);
    }

    //触发间隔
    private Long interval = 0L;

    //触发间隔(时间单位)
    private TimeUnit unit = TimeUnit.SECONDS;

    //重复次数
    private Integer repeat = 0;

    public Long getInterval() {
        return interval;
    }

    public void setInterval(Long interval) {
        this.interval = interval;
    }

    public TimeUnit getUnit() {
        return unit;
    }

    public void setUnit(TimeUnit unit) {
        this.unit = unit;
    }

    public Integer getRepeat() {
        return repeat;
    }

    public void setRepeat(Integer repeat) {
        this.repeat = repeat;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(super.toString())
                .add("interval", interval)
                .add("unit", unit)
                .add("repeat", repeat)
                .toString();
    }
}
